<?php
if(!defined('IN_DSW')){exit('大神请返回地球，我们需要你');}
/*
 * 错误页面模块 2018-04-17 
 */
class action extends app{
	public function display(){
		$action = $this->routes->url(3);
		if(!method_exists($this,$action))
		$action = "index";
		$this->$action();
		exit;
	}

	private function index(){
		$sip=$this->G->loadclass('tinwin')->getClientIp();
		$CurUrl=$this->errorpage->curPageURL();
		$newpage=$this->errorpage->getOne301(array('errorpage'=>$CurUrl));
		if($newpage['newpage']){
			header("Location:".$newpage['newpage']);
		}
		if(empty($_SESSION['tinwinsession']['uid'])){
			$row=array(
				'adduser'=>0,
				'addtime'=>TIME,
				'errorpage'=>$CurUrl,
				'ip'=>$sip
			);
			$this->dbpdo->insert_data('errorpage',$row);
		}else{
			$row=array(
				'adduser'=>$_SESSION['tinwinsession']['uid'],
				'addtime'=>TIME,
				'errorpage'=>$CurUrl,
				'ip'=>$sip
			);
			$this->dbpdo->insert_data('errorpage',$row);
		}
		$this->tpl->display('index');
	}
}
?>
